class JinLiang:
    def __init__(self, jin: int, liang: int):
        # 一斤等于十六两，统一转换为两来存储
        self.total_liang = jin * 16 + liang

    @property
    def jin(self):
        return self.total_liang // 16

    @property
    def liang(self):
        return self.total_liang % 16

    def __str__(self):
        return f"{self.jin}斤{self.liang}两"

    def __repr__(self):
        return f"JinLiang({self.jin}, {self.liang})"

    def __lt__(self, other):
        if not isinstance(other, JinLiang):
            raise TypeError("只能比较 JinLiang 类型的对象")
        return self.total_liang < other.total_liang

    def __le__(self, other):
        if not isinstance(other, JinLiang):
            raise TypeError("只能比较 JinLiang 类型的对象")
        return self.total_liang <= other.total_liang

    def __eq__(self, other):
        if not isinstance(other, JinLiang):
            raise TypeError("只能比较 JinLiang 类型的对象")
        return self.total_liang == other.total_liang

    def __gt__(self, other):
        if not isinstance(other, JinLiang):
            raise TypeError("只能比较 JinLiang 类型的对象")
        return self.total_liang > other.total_liang

    def __ge__(self, other):
        if not isinstance(other, JinLiang):
            raise TypeError("只能比较 JinLiang 类型的对象")
        return self.total_liang >= other.total_liang

    def __add__(self, other):
        if not isinstance(other, JinLiang):
            raise TypeError("只能与 JinLiang 类型的对象进行加法")
        total = self.total_liang + other.total_liang
        jin = total // 16
        liang = total % 16
        return JinLiang(jin, liang)

    def __sub__(self, other):
        if not isinstance(other, JinLiang):
            raise TypeError("只能与 JinLiang 类型的对象进行减法")
        a = self.total_liang
        b = other.total_liang
        diff = abs(a - b)
        jin = diff // 16
        liang = diff % 16
        return JinLiang(jin, liang)

# === DO NOT modify the code below ===
def main():
    j1 = JinLiang(3,8)
    j2 = JinLiang(2,9)
    assert j1 > j2
    assert j1 + j2 == JinLiang(6,1)
    assert j1 - j2 == JinLiang(0,15)
    assert j2 - j1 == JinLiang(0,15)
    assert str(j1+j2) == '6斤1两'
    
    print("Congratulations! All tests are passed!")

if __name__=="__main__":
    main()
# === DO NOT modify the code above ===